package com.zyk.scaffold.oauth.config.oauth.support;

import com.zyk.scaffold.oauth.domain.LocalTenantUserDetails;
import com.zyk.scaffold.oauth.framework.domain.OauthContext;
import com.zyk.scaffold.oauth.framework.interfaces.ITokenConvert;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class LocalRefreshTokenConvert implements ITokenConvert {

    @Override
    public void convert(OauthContext context, Map<String, Object> convertData) {
        LocalTenantUserDetails userDetails = (LocalTenantUserDetails) context.getUserDetails();
        convertData.put("tenantCode", userDetails.getTenantCode());
        convertData.put("tenantName", userDetails.getTenantName());
    }

    @Override
    public boolean registerAccessTokenConvert(ITokenConvert tokenConvert) {
        return false;
    }

    @Override
    public boolean registerRefreshTokenConvert(ITokenConvert tokenConvert) {
        return false;
    }
}
